Declaration of a structured data type in ST
Syntax |
---|
|
Meaning | |
---|---|
Declaration of one or more →structured data types (
A data type is possible as a type for a structure element. See "Supported data types" to learn which data types are supported for the declaration. Moreover, a →reference ( Use the optional →initial value The optional statement {
|
Good to know |
---|
See "Accessing the structured data type and structure elements", if you need information about accessing the structure elements. Moreover, Neuron Power Engineer allows you to define a not yet fully specified location for the declaration. See "Declaration of a language element with partial address in ST" for details.
Moreover, Neuron Power Engineer allows you to define the optional attribute Moreover, Neuron Power Engineer allows you to specify additional data for the declaration. See "Defining description, comment, JSON string or type for variables or data types" for details. |
Examples without the specification affecting the sorting of the structure elements |
---|
|
Without the statement {KeepElementOrder
}, the structure elements are automatically sorted within the generated C-code. For this automatic sorting, the data type is used at first (starting with BOOL
, continuing with rising data type size, concluding with structure and array data types). In case of a same data type, sorting is done according to the element name (with alphanumeric order).
Example with the specification affecting the sorting of the structure elements |
---|
|
Without statement {KeepElementOrder}
, the above structure elements would be automatically sorted as follows:
-
scaling : BOOL;
-
max: INT;
-
min: INT;
-
noScaling : Range2;
If an element is using another structure data type and you want to have the elements of this structure data type sorted as declared, you have to insert the statement {KeepElementOrder
} for this other structure data type as well. Regarding the example, the statement {KeepElementOrder
} would have to be inserted in front of the declaration of the structure data type Range2
, too.
Example for the initialization of a structure element where a different structure data type is used |
---|
|